package com.wjj.sixinone.common.util;



import com.wjj.sixinone.common.pojo.entity.User;

import java.util.Map;

public class AuthContextUtil {



    //创建threadLocal对象

    public static final ThreadLocal<User> threadLocal=new ThreadLocal<>();
    public static final ThreadLocal<Map<String,String>> threadLocalMap=new ThreadLocal<>();
    //添加数据

    public static void set(User sysUser){
        threadLocal.set(sysUser);
    }

    //获取数据
    public static User get(){
        return threadLocal.get();
    }

    //删除数据
    public static void remove(){
        threadLocal.remove();
    }

//    public static void setToMap(Map map){
//        threadLocalMap.set(map);
//    }
//    public static String getToMap(String k){
//        Map<String,String> map = threadLocalMap.get();
//        return  map.get(k);
//    }
//    public static void removeMap(String k){
//        Map<String,String> map = threadLocalMap.get();
//        map.remove(k);
//        threadLocalMap.remove();
//        threadLocalMap.set(map);
//    }
}
